import { Project } from "./list";
import React, { useEffect, useCallback } from "react";
import { useAsync, cleanObject } from "utils/index";
import { getProjects } from "service/login";
import { MjcResponseData } from "service/type";
import { useQuery } from "react-query";
export const useProjects = (param?: Partial<Project>) => {
  return useQuery<MjcResponseData["data"], Error>(["projects", param], () =>
    getProjects<MjcResponseData>(cleanObject(param || {}), "singer")
      .then((res) => {
        return res.data;
      })
      .catch((err) => {
        return Promise.reject([]);
      })
  );
};
